<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>lesson 7</title>
  <script src="https://unpkg.com/vue@next"></script>
  <style>

    .tl-font24-fff{
      color: #fff;
    }
    .transition{
      transition: 3s background-color ease;
    }

  </style>
</head>
<body>
  <div id="root"></div>
</body>
<script>
  const app = Vue.createApp({
    data() {
      return {
        message: "hello world",
        styleObj: {
          background: 'blue'
        },
      }
    },
    methods: {
      handleClick(){
        if(this.styleObj.background === 'blue' || this.styleObj.background === 'orange'){
          this.styleObj.background = 'green'
        }else {
          this.styleObj.background = 'orange'
        }
      }
    },

    template: `
      <div>
      <div class="transition tl-font24-fff" :style="styleObj">
        Hello Word
      </div>
      <div>
        <button @click="handleClick">切换</button>
      </div>
      </div>
    `
  });
  const vm = app.mount('#root');
</script>
</html>